home *** CD-ROM | disk | FTP | other *** search
- /* exit.c --- BIBLE pp. 83-84 */
- #include <stdio.h>
- main()
- {
- FILE *fp;
- char filename[40];
- printf("Enter name of file to be opened for writing:");
- gets(filename);
- if((fp = fopen(filename, "w+")) == NULL)
- {
- perror("File open error");
- abort();
- }
- fprint(fp, "If you use \"exit\", this line will appear in the file\n"
- "because it flushes buffers\n", filename);
- exit(0);
- }